import Layout from "@/layout";
import React from "react";
import { RouteObject } from "../types";
import { lazyload, toPlainRoutes } from "../utils/toolkit";

const common: RouteObject[] = [
  {
    // element: <Layout></Layout>,
    element: lazyload(React.lazy(() => import("@/layout"))),
    children: [
      {
        path: "/dashboard",
        meta: {
          title: "首页",
          icon: "HomeOutlined",
        },
        element: lazyload(React.lazy(() => import("@/views/dashboard/index"))),
      },
      {
        path: "/register",
        meta: {
          title: "注册",
        },
        element: lazyload(React.lazy(() => import("@/views/register/index"))),
      },
      {
        path: "/ocr",
        meta: {
          title: "tesseractjs",
        },
        element: lazyload(React.lazy(() => import("@/views/ocr/index"))),
      },
    ],
  },
];

// 去除element的引用，素路由
export const plafinCommonRoutes = toPlainRoutes(common);

export default common;
